-- Leviathan (c) v.v.balashoff
local Class = require('leviathan/Class')
local Tween = require('libs/tween/tween')

local FadeComponent = Class:derive('FadeComponent')

function FadeComponent:new(name, target, alpha, easing, duration)
    self.id = 'FadeComponent'
    self.typeId = 'Fade'
    self.drawable = true
    self.enabled = true

    self.name = name or self.id
    self.alpha = alpha or 1
    self.easing = easing or 'in'
    self.duration = duration or 3

    self.tween = Tween.new(self.duration, target, {alpha = self.alpha}, easing)
    self.tween:reset()
end

return FadeComponent
